//
//  Link.m
//  Portable Traffic Signal Assistor
//
//  Created by Ding on 8/31/12.
//  Copyright (c) 2012 TTU. All rights reserved.
//

#import "Link.h"

@implementation Link
@synthesize linkID=_linkID;
@synthesize linkName=_linkName;
@synthesize fromIntersectionID=_fromIntersectionID;
@synthesize toIntersectionID=_toIntersectionID;
@synthesize linkDirection=_linkDirection;
@synthesize length=_length;
@synthesize speedLimit=_speedLimit;
@synthesize parentSubSystemID=_parentSubSystemID;
@synthesize parentAgencyID=_parentAgencyID;

- (void) dealloc
{
    [_linkID release];
    [_linkName release];
    [_fromIntersectionID release];
    [_toIntersectionID release];
    [_linkDirection release];
    [_length release];
    [_speedLimit release];
    [_parentAgencyID release];
    [_parentSubSystemID release];
    [super dealloc];
}

- (float) getSpeedLimitFeetSecond
{
    float slope=[self.speedLimit floatValue]*5280/3600;
    return slope;
}

-(int) getScreenXofLinkTravelTime
{
    return round([self.length floatValue]/[self getSpeedLimitFeetSecond]);
    
}
-(int) getScreenYofLinkLength
{
    return round([self.length intValue]/[SMRTStaticConfiguration getMileToScreenYRatio]);
}

@end
